package io.datajek.springbasics.movierecommendersystem;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.beans.factory.annotation.Autowired;

@Component
public class RecommenderImplementation {

   //根据名字的自动装配
    //@Autowired
   // @Qualifier("CF")
   private Filter filter;
   //使用过滤器来获得
@Autowired
//@Qualifier("contentBasedFilter")
  // public void setFilter(Filter filter){
     // this.filter=filter;
    //  System.out.println("Setter method invoked");
   //}
   public RecommenderImplementation(@Qualifier("collaborativeFilter")Filter filter) {
    super();
    this.filter = filter;
   System.out.println("Constructor invoked");
}
  public String[] recommendMovies(String movie){
        //打印正在使用的接口实现的名称
     System.out.println("\nName of the filter in use" +filter +"\n");
        String[] results = filter.getRecommendations("Finding Dory");
      return results;
    }

}
